#pragma once

#include <string>
#include <set>
#include <functional>
#include "Singleton.h"
#include "MsgRouter.h"
#include "agency.h"

class AgencyService
{
public:
    bool Init();

public:
    AgencyService() = default;
    virtual ~AgencyService() = default;

public:
    static AgencyService* Instance()
	{
		return CSingleton<AgencyService>::Instance();
	}

public:
    enum Sence
    {
        AUTH = 100,
        BET_AND_WIN = 101,
        BET = 102,
        WIN = 103,
        CANCLE_BET = 104,
        BALANCE = 105,
        CANCLE_BET_AND_WIN = 106,
        KICK_PLAYER = 107,
        REWARD = 108,
    };
public:
    bool HandleGetAgency(const std::string& name, std::string&& trans, Sence sence);
    void OnAgencyGet(MsgData&& data);
    void OnSenceAgencyGet(Sence sence, std::string&& trans, std::int32_t err_code, stAgency* agency);
    inline void ListenOnAgencyGet(Sence sence, std::function<void(std::int32_t err_code, stAgency*  agency, std::string&& trans)> listen)
    {
        m_agencyuser_get_listen[sence] = listen;
    }
private:
    std::map<Sence, std::function<void(std::int32_t err_code, stAgency* agency, std::string&& trans)>> m_agencyuser_get_listen;

};










